<{strip}>
<!--  sidear start -->
<div id="sidebar" role="complementary">
    <!-- Search Start -->
    <div id="search">
        <form method="post" id="searchform" action="<{spUrl c=main a=search}>">
            <span class="st">
                <input type="text" value="" name="s" id="s" class="searchtxt" />
            </span><span class="ss">
                <input type="submit" name="submit" value="" class="searchsm"  onclick="javascript: return document.getElementById('s').value!='';"/>
            </span>
        </form>
    </div>
    <div class="clear"></div>
    <!-- Search End -->
    <ul>
        <li id="meta-2" class="widget widget_meta">
            <h2 class="widgettitle">用户</h2>

            <ul id="userlogined"  <{if $userinfo eq true}>style="display:;"<{else}>style="display:none;" <{/if}> >
                <li>欢迎你：<a id="screenname"><{$userinfo.screenname}></a></li>
                <li>上次登录：<a id="lastlogin"><{$userinfo.lastlogin}></a></li>
                <li>登录次数：<a id="logincount"><{$userinfo.logincount}></a></li>

                <li><a href="<{spUrl c=post a=write}>">发表文章</a> &nbsp;&nbsp;  &nbsp;&nbsp;<a href="<{spUrl c=admin a=index}>">管理</a>  </li>
                <li><a href="#" onclick="return userloginout();">登出</a></li>
            </ul>
            <ul id="userlogin"   <{if $userinfo eq true}>style="display:none;"<{else}>style="display:;" <{/if}>>
                <li>用户名：<input type="text" id="username" /></li>
                <li>密　码：<input type="password" id="password" /></li>
                <li><input type="checkbox" id="remember" value='1'/>下次自动登录</li>
                <li>　　　<input type="submit" value="　登录　"  onclick="return loginsubmit();" />　<input type="reset"value="　重置　" /></li>
            </ul>
        </li>
        <li id="categories-2" class="widget widget_categories">
            <h2 class="widgettitle">分类目录</h2>
            <ul>
                <{foreach item=item from=$category}>
                <li class="cat-item cat-item-4"><{$item.leftpad}><a href="<{spUrl c=main a=category id=$item.id}>" title="查看<{$item.dispname}>下的所有文章"><{$item.name}></a> </li>
                <{/foreach}>
            </ul>
        </li>
        <li id="recent-posts-2" class="widget widget_recent_entries">
            <h2 class="widgettitle">近期文章</h2>
            <ul>
                <{foreach item=item from=$topnews}>
                <li><a href="/#" title="<{$item.title}>" onclick="return checkacl(<{$item.id}>);"><{$item.title}></a></li>
                <{/foreach}>
            </ul>
        </li>
        <li id="recent-comments-2" class="widget widget_recent_comments">
            <h2 class="widgettitle">近期评论</h2>
            <ul id="recentcomments">
                <{foreach item=item from=$topcomments}>
                <li class="recentcomments"><{$item.screenname}>发表在《<a href="/#" onclick="return checkacl(<{$item.id}>);"><{$item.title}></a>》</li>
                <{/foreach}>
            </ul>
        </li>
        <li id="archives-2" class="widget widget_archive">
            <h2 class="widgettitle">文章归档</h2>
            <ul>
                <{foreach item=item from=$archive}>
                <li><a href='<{spUrl c=main a=archive d=$item.created}>' title='<{$item.created}>'><{$item.created}>(<{$item.postcount}>)</a></li>
                <{/foreach}>
            </ul>
        </li>
        <li id="text-2" class="widget widget_text">
            <h2 class="widgettitle">背景音乐</h2>
            <div class="textwidget">
                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="165" height="40" id="niftyPlayer1" align="">
                    <param name=movie value="/attached/media/niftyplayer.swf?file=/attached/media/<{'1'|rand:'2'}>.mp3&as=1">
                    <param name=quality value=high>
                    <embed src="/attached/media/niftyplayer.swf?file=/attached/media/<{'1'|rand:'2'}>.mp3&as=1" quality=high bgcolor=#FFFFFF width="165" height="40" name="niftyPlayer1" align="" type="application/x-shockwave-flash" swLiveConnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer">
                    </embed>
                </object>
            </div>
        </li>
        <li id="archives-2" class="widget widget_archive">
            <h2 class="widgettitle">友情链接</h2>
            <ul><li><a href="http://www.usst.edu.cn" target="_BLANK">上海理工大学</a></li>
            </ul>
        </li>

    </ul>
</div>   <!-- end sidebar  -->

<script type="text/javascript">
    function checkacl(id,pub){
		if (pub=='1')
		{
        window.location.href="/index.php?c=main&a=article&id="+id;
		return true;
		}
        $.post("<{spUrl c=main a=checkacl}>",{},function(msg){
            if (msg.msg=="OK")
            {
                window.location.href="/index.php?c=main&a=article&id="+id;
            }
            else
            {
                alert('您需要登录后才能访问！');
                return false;
            }
        }
        ,'json');
    }

    function loginsubmit(){
        if ($("#username").val()=="")
        {	   alert("用户名不能为空！");
            $("#username").focus();
            return false;
        }
        if ($("#password").val()=="")
        {	   alert("密码不能为空！");
            $("#password").focus();
            return false;
        }
        $.post("<{spUrl c=main a=login}>",
        {
            'username':$("#username").val(),
            'password':$("#password").val(),
            'remember':$("#remember").attr('checked')
        },
        function(e){
           if (e.msg=='OK')
            {
                $("#userlogin").hide();
 				$("#screenname").html(e.screenname);
                $("#lastlogin").html(e.lastlogin);
                $("#logincount").html(e.logincount);
                $("#userlogined").show();
            }
            else
            {
                alert('用户名或密码错误！');
                return false;
            }

        },'json'
    ) ;

    }
    function userloginout(){
        $.post("<{spUrl c=admin a=logout}>");
        $("#userlogin").show();
        $("#userlogined").hide();

    }
</script>
<{/strip}>